﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;

namespace ERE
{
    class Program
    {
        static void Main(string[] args)
        {
            //DateTime now = DateTime.Now;//现在时间
            //DateTime last = now.AddDays(-33);//创建时间
            //int r = new TimeSpan(now.Ticks - last.Ticks).Days * -1;//相差多少天
            //Console.WriteLine(now + "***" + last + "***" + r);
            //Console.WriteLine("=============================================");
            //int ice = 10000;
            //int iop = 10000;
            //if ((int)(((double)(ice % iop) / iop) * 100) == 0 )
            //{
            //    if (ice==0)
            //    {
            //        Console.WriteLine("进度"+ (int)(((double)(ice % iop) / iop) * 100)+"没充过钱");
            //    }
            //    else{
            //        Console.WriteLine("正常进度" + (int)(((double)(ice % iop) / iop) * 100)+"充了"+ice);
            //    }
            //}
            //else
            //{
            //    Console.WriteLine("正常进度" + (int)(((double)(ice % iop) / iop) * 100) + "充了" + ice);
            //}

            //List<Goods> listtt = new List<Goods>();
            //listtt.Add(new Goods()
            //{
            //    ID = 1,
            //    Name = "测试1",
            //    Num = 300
            //});
            //listtt.Add(new Goods()
            //{
            //    ID = 2,
            //    Name = "测试2",
            //    Num = 100
            //});
            //listtt.Add(new Goods()
            //{
            //    ID = 3,
            //    Name = "测试3",
            //    Num = 600
            //});
            //listtt.Add(new Goods()
            //{
            //    ID = 4,
            //    Name = "测试4",
            //    Num = 20
            //});
            ////SortedDictionary<int, Goods> kuekue = new SortedDictionary<int, Goods>();
            ////List<Goods> newlisttt = new List<Goods>();
            ////foreach (var item in listtt)
            ////{
            ////    kuekue.Add(item.Num, item);
            ////}
            ////foreach (var item in kuekue)
            ////{
            ////    newlisttt.Add(item.Value);
            ////    Console.WriteLine(item.Key+"**"+item.Value.Name);
            ////}
            ////Console.WriteLine("===================================");
            ////foreach (var item in newlisttt)
            ////{
            ////    Console.WriteLine(item.Name);
            ////}
            //int i = 15 / 7;
            //int[] indexsss = new int[i];

            //List<int> ShowIndex_num = new List<int>();
            //List<Goods> data = new List<Goods>() {
            //    new Goods() { ID = 1, Name = "名字1", Num = 120 },
            //    new Goods() { ID = 2, Name = "名字2", Num = 100 },
            //    new Goods() { ID = 3, Name = "名字3", Num = 10 },
            //    new Goods() { ID = 4, Name = "名字4", Num = 90 },
            //    new Goods() { ID = 4, Name = "名字4", Num = 90 },
            //    new Goods() { ID = 4, Name = "名字4", Num = 90 },
            //    new Goods() { ID = 4, Name = "名字4", Num = 90 },
            //    new Goods() { ID = 4, Name = "名字4", Num = 90 },
            //    new Goods() { ID = 4, Name = "名字4", Num = 90 },
            //};
            ////9/5

            //for (int j = 0; j < data.Count / 5; j++)
            //{
            //    if (0 == (data.Count / 5))
            //    {
            //        ShowIndex_num.Add(j + 1);
            //    }
            //    else
            //    {
            //        ShowIndex_num.Add(j + 1);
            //        ShowIndex_num.Add(j + 1 + 1);
            //    }

            //}
            //foreach (var item in ShowIndex_num)
            //{
            //    Console.WriteLine(item);
            //}
            //Console.WriteLine("-------------分页功能--------------");
            ////源数据
            //List<string> data = new List<string>() { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" };
            ////分页数组  为了数据绑定
            //List<int> Index_Num = new List<int>();
            ////分割后的数据
            //SortedDictionary<int, List<string>> 分割后的总数据源 = new SortedDictionary<int, List<string>>();
            ////中间临时存储数据
            //List<string> TempIndexItem = null;
            ////获取分页后的余数  最后一页不足4页的情况 yushu!=0
            //int yushu = data.Count() % 4;
            ////获取有多少个分页  以4个为1页
            //if (data.Count() % 4 == 0)//是否能分完
            //{
            //    //往分页数组内加入分页数 为了数据展示，分页数组第一个元素+1
            //    for (int j = 0; j < data.Count() / 4; j++)
            //    {
            //        Index_Num.Add(j + 1);
            //    }
            //}
            //else
            //{
            //    //往分页数组内加入分页数 为了数据展示，分页数组第一个元素+1
            //    for (int j = 0; j < data.Count() / 4; j++)
            //    {
            //        Index_Num.Add(j + 1);
            //    }
            //    //因为有余数  还要加最后一页
            //    Index_Num.Add((data.Count() / 4) + 1);
            //}
            //Console.WriteLine("分页数：" + Index_Num.Count());
            //int max = 0;
            //int min = 0;
            //int num = 1;
            //int temp = 0;
            //for (; num <= Index_Num.Count();)
            //{
            //    TempIndexItem = new List<string>();
            //    max = num * 4;
            //    min = max - 4;
            //    for (; min < max; min++)
            //    {
            //        try
            //        {
            //            TempIndexItem.Add(data[min]);
            //        }
            //        catch (Exception)
            //        {
            //            if (yushu != 0)
            //            {
            //                TempIndexItem.Clear();
            //                int j = data.Count() - yushu;
            //                for (int i = 0; i < yushu; i++)
            //                {
            //                    TempIndexItem.Add(data[j]);
            //                    j++;
            //                }
            //            }
            //            break;
            //        }
            //    }
            //    分割后的总数据源.Add(temp, TempIndexItem);
            //    num++;
            //    temp++;
            //};
            //var a = 分割后的总数据源[0];
            //Console.WriteLine(a.GetType() + a[0]);
            //Console.WriteLine();
            Console.WriteLine("---------------------------");

            //if (true && true)
            //{
            //    Console.WriteLine("或者？");
            //}
            //else
            //{
            //    Console.WriteLine("也许？");
            //}
            //while (true)
            //{
            //    Console.Write("输入：");
            //    string are = Console.ReadLine();
            //    //Regex reg = new Regex(@"^[1]+[3,5]+\d{9}");
            //    Console.WriteLine(Regex.IsMatch(are, "^[\u4e00-\u9fa5]{0,}$"));
            //}
            //for (int i = 0; i < 10; i++)
            //{
            //    int num = new Random().Next(1,4);
            //    Console.WriteLine("数字是：" + num);
            //}
            //string str = "../images/yzm7364.jpg";
            //Console.WriteLine(str.Substring(13,4));

            Console.WriteLine("-----------------------------------");
            //DateTime now = DateTime.Now;
            //DateTime last = new DateTime(2021, 5, 21, 6, 30, 12);
            //Console.WriteLine(now.ToLongDateString());
            //TimeSpan sp = last.Subtract(now);
            //Console.WriteLine(sp.Days);//相隔天数
            //Console.WriteLine(sp.Hours);//相隔小时
            //Console.WriteLine(sp.Minutes); //相隔分钟
            //Console.WriteLine(sp.Seconds);//相隔秒数



            //if (now.Year == last.Year)
            //{
            //    Console.WriteLine("同年");
            //    if (now.Month == last.Month)
            //    {
            //        Console.WriteLine("同月");
            //        if (now.Day == last.Day)
            //        {
            //            Console.WriteLine("同年同月同天");
            //            if (now.Hour == last.Hour)
            //            {
            //                Console.WriteLine("同年同月同天同一小时段");
            //                if (now.Minute == last.Minute)
            //                {

            //                }
            //            }
            //            else
            //            {
            //                Console.WriteLine("同年同月同天不同一小时段");
            //            }
            //        }
            //        else
            //        {
            //            Console.WriteLine("同年同月不同日");
            //        }
            //    }
            //    else
            //    {
            //        Console.WriteLine("同年不同月");
            //    }
            //}
            //else
            //{
            //    Console.WriteLine("不同年");
            //}


            //Dictionary<string, List<string>> Comm = new Dictionary<string, List<string>>();
            //Comm.Add("name1", new List<string>()
            //{
            //     "touxiang1","评论1"
            //});
            //Comm.Add("name2", new List<string>()
            //{
            //     "touxiang2","评论2"
            //});
            //Comm.Add("name3", new List<string>()
            //{
            //     "touxiang3","评论3"
            //});
            //Comm.Add("name4", new List<string>()
            //{
            //     "touxiang4","评论4"
            //});
            //Comm.Add("name5", new List<string>()
            //{
            //     "touxiang5","评论5"
            //});
            //foreach (var item in Comm.Keys)
            //{
            //    Console.WriteLine(item);
            //}
            //foreach (var item in Comm.Values)
            //{
            //    Console.WriteLine(item[0] + item[1]);
            //}

            //Console.WriteLine("结果："+ Regex.IsMatch("1231231231231231", @"^(\d{16})$"));  //16位数字


            //IAsyncResult asyncResult = null;
            //AsyncCallback callback = new AsyncCallback(ia => { Console.Write(ia.AsyncState+"完成了！线程为："+Thread.CurrentThread.ManagedThreadId); });
            //Action<string> action = AAA;
            //for (int i = 0; i < 5; i++)
            //{
            //    action("名字"+i);
            //    asyncResult  =  action.BeginInvoke("名字" + i, callback, "状态");
            //}
            //asyncResult.AsyncWaitHandle.WaitOne();
            //asyncResult = null;
            //AsyncCallback asyncCallback = r => Console.WriteLine("\n3216546");
            //IAsyncResult newA = null;
            //Func<int> func = () => {  return 1; };
            //newA = func.BeginInvoke(asyncCallback, null);
            //var ase = func.EndInvoke(newA);
            //Console.WriteLine("回调成功："+ase);


            //while (!asyncResult.IsCompleted)
            //{
            //    Console.WriteLine("没完成");
            //}
            //Console.WriteLine("完成了");
            //asyncResult.AsyncWaitHandle.WaitOne();


            //150 * 100
            Console.WriteLine("------------------------");
            var ace = ((double)(980 % 9000) / 9000);
            Console.WriteLine(ace);
            var asdaw = (ace * 100);
            Console.WriteLine(asdaw);
            Console.WriteLine(1 > (((double)(980 % 9000) / 9000) * 100));
            Console.WriteLine(0 == (int)(((double)(980 % 9000) / 9000) * 100));
            Console.WriteLine((int)(((double)(980 % 9000) / 9000) * 100)); 
            //Console.WriteLine(( * 100));
            Console.ReadKey();
        }
        public static void AAA(string name)
        {
            int a = 0;
            for (int i = 0; i < 1000000; i++)
            {
                a += i;
            }
            Console.WriteLine(name);
        }
    }
}
